#!/bin/sh

# resolve links - $0 may be a softlink
PRG="$0"

while [ -h "$PRG" ]; do
  ls=`ls -ld "$PRG"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '/.*' > /dev/null; then
    PRG="$link"
  else
    PRG=`dirname "$PRG"`/"$link"
  fi
done

PRGDIR=`dirname "$PRG"`
BASEDIR=`cd "$PRGDIR" >/dev/null; pwd`

JAVACMD="$BASEDIR/runtime/bin/java"

exec $JAVACMD \
  -splash:"$BASEDIR/resources/images/splashscreen.png" \
  -cp "$BASEDIR/libs/*:$BASEDIR/plugins/*" \
  -Xmx4096M \
  -XX:+UnlockExperimentalVMOptions \
  -XX:+UseShenandoahGC \
  -XX:ShenandoahGCHeuristics=compact \
  -XX:ShenandoahAllocationThreshold=20 \
  -Dapp.name="binjr" \
  -Dapp.pid="$$" \
  -Dapp.home="$BASEDIR" \
  -Dbasedir="$BASEDIR" \
  -Dbinjr.portable=true \
  "eu.binjr.core.Binjr" \
  "--packaging=MAC_TAR" \
  "$@"
